{% extends 'admin/public/base.html' %}

{% block title %}
<title>商品管理--添加</title>
{% endblock %}

{% block script %}
<script src="/static/admin/js/uploadPreview.js"></script>
<link rel="stylesheet" type="text/css" href="/ueditor/UE/third-party/SyntaxHighlighter/shCoreDefault.css">
<script type="text/javascript" src="/ueditor/UE/third-party/SyntaxHighlighter/shCore.js"></script>
<script type="text/javascript" src="/ueditor/UE/ueditor.config.js"></script>
<script type="text/javascript" src="/ueditor/UE/ueditor.all.min.js"></script>
<script type="text/javascript" src="/ueditor/UE/lang/zh-cn/zh-cn.js"></script>
{% endblock %}


{% block con %}            
<div class="container-fluid am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
            <div class="page-header-heading">
                <span class="am-icon-home page-header-heading-icon"></span> 商品添加 
            </div>
        </div>
       
    </div>
</div>

<div class="row-content am-cf">
    <div class="row  am-cf">
        
        <div class="row">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                <div class="widget am-cf">
                    
                    <div class="widget-body am-fr">

                        <form class="am-form tpl-form-line-form" action="{% url 'myadmin_good_insert' %}" method="POST" enctype="multipart/form-data" >
                            {% csrf_token %}
                            <!-- 商品名 -->
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">商品名</label>
                                <div class="am-u-sm-9">
                                    <select name="tid" data-am-selected="">
                                        {% for i in info %}
                                            {% if i.pid == 0 %}
                                                <option value="{{ i.id }}" disabled >{{ i.name }}</option>                                            
                                            {% else %}
                                                <option value="{{ i.id }}" ><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>{{ i.name }}</option>
                                            {% endif %}
                                        {% endfor %}
                                    </select>                                    
                                </div>                                
                            </div>

                            <!-- 商品类别 -->
                            <div  class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">商品类别</label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="tpl-form-input" required  maxlength="30" name="title" id="user-name" >
                                    <small>请填写类别</small>
                                </div>
                            </div>

                            <!-- 商品价格 -->
                            <div  class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">商品价格</label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="tpl-form-input" required  maxlength="30" name="price" id="user-name" >
                                    <small>请填写价格</small>
                                </div>
                            </div>

                            <!-- 商品库存 -->
                            <div  class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">商品库存</label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="tpl-form-input" required  maxlength="30" name="num" id="user-name" >
                                    <small>请填写库存</small>
                                </div>
                            </div>
                            
                            <!-- 上传商品图片 -->
                            <div class="am-form-group">
                                <label for="user-weibo" class="am-u-sm-3 am-form-label">
                                    上传商品图片
                                </label>
                                <div class="am-u-sm-9">
                                    <div class="am-form-group am-form-file"> 
                                        <ul id="warp">
                                            <li>                                                
                                                <div class="tpl-form-file-img">
                                                    <img id="imgShow_WU_FILE_0" width="100" height="100" src="/static/pics/user.jps">
                                                    
                                                    <input name="pic" type="file" id="up_img_WU_FILE_0">
                                                </div>
                                                <i class="am-icon-cloud-upload" ></i> 上传商品图片
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>

                            <!-- 文本编辑域 -->
                            <div class="am-form-group">
                                <label for="user-intro" class="am-u-sm-3 am-form-label">商品详情</label>
                                <div class="am-u-sm-9">
                                    <script id="editor" style="color:#c4c4c4" name="info" type="text/plain" style="height:400px;"></script>
                                </div>
                            </div>

                            <!-- 提交 -->
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3">
                                    <button class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    var ue = UE.getEditor('editor');
    SyntaxHighlighter.all();
</script>
{% endblock %}      
